package com.itheima.edu.info.manager;

import com.itheima.edu.info.manager.service.StudentService;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ServerApplication {
    public static void main(String[] args)throws Exception {
            //创建服务器端socket
        ServerSocket serverSocket = new ServerSocket(11);
        ExecutorService threadPool = Executors.newFixedThreadPool(20);

        while (true) {
            //监听客户端连接
            Socket socket = serverSocket.accept();
            //创建一个线程任务，去处理这个socket请求
            StudentService service = new StudentService(socket);
            threadPool.submit(service);
        }

    }
}
